package com.pengweiwei.androidzygote.video.data;

import android.text.TextUtils;

import com.pengweiwei.androidzygote.video.data.beans.FooterBean;
import com.putong35.common.app.BaseApplication;
import com.putong35.common.httprequest.IHttpRequest;
import com.putong35.common.httprequest.OnFailureListener;
import com.putong35.common.httprequest.OnSuccessListener;
import com.putong35.common.httprequest.UrlParams;
import com.putong35.common.httprequest.app.MyHttpRequest;
import com.putong35.common.httprequest.responsecallbacks.StringResponseListener;
import com.putong35.common.utils.GsonUtils;

import java.util.List;

public class VideoApiHelper {

    public static void footer(int type, OnSuccessListener<List<FooterBean>> successListener, OnFailureListener failureListener) {
        /*Retrofit retrofit = BaseApplication.retrofit();
        MineApi request = retrofit.create(VideoApi.class);

        HashMap<String, String> map = new HashMap<>();
        map.put("appVersion", "1.0");
        map.put("content", content);
        map.put("type", "" + type);

        Call<String> call = request.feedback(map);
        HttpCommonCallback<String> callback = new HttpCommonCallback<>(successListener, failureListener);
        call.enqueue(callback);*/


        IHttpRequest request = new MyHttpRequest(BaseApplication.getAppContext());
        UrlParams urlParams = new UrlParams();
        urlParams.put("type", "" + type);
        request.get(VideoApi.URL_VIDEO_FOOTER, urlParams, new StringResponseListener() {
            @Override
            public void onSuccess(String response) {
                if (!TextUtils.isEmpty(response) && successListener != null) {
                    List<FooterBean> listData = GsonUtils.string2ObjecetList(response, FooterBean[].class);
                    successListener.onSuccess(1, "成功", listData, null);
                }
            }

            @Override
            public void onFailure(Throwable t, int errorNo, String strMsg) {
                if (failureListener != null) {
                    failureListener.onFailure(errorNo, strMsg);
                }
            }
        });

    }




}
